#include"tea_demo.h"

lv_obj_t *tea_text;
static lv_obj_t * return_btn;
static lv_obj_t * return_label;
static void return_btn_event_cb(lv_event_t*e)
{
    lv_event_code_t code = lv_event_get_code(e);
    if(code == LV_EVENT_CLICKED)
    {
             printf("return user success!\n");
             lv_obj_del(tea_text);
             admini_jm();                                              //系统运行界面
    }
}

void lv_main_demo(void)
{
    tea_text = lv_textarea_create(lv_scr_act());
    lv_obj_set_size(tea_text,600,300);
    lv_obj_align(tea_text,LV_ALIGN_LEFT_MID,20,0);

    lv_obj_set_style_text_font(tea_text,&lv_font_source_han_sans_bold_14,0);

    /* 创建返回按钮 */
    return_btn = lv_btn_create(tea_text);
    lv_obj_set_size(return_btn, 100, 44);
    lv_obj_align(return_btn, LV_ALIGN_BOTTOM_RIGHT, -30, -60);
     /*创建返回标签 */
    return_label = lv_label_create(return_btn);
    lv_label_set_text(return_label, "返回");
    lv_obj_set_style_text_font(return_label,&lv_font_source_han_sans_bold_14,0);
    lv_obj_set_style_text_color(return_label, lv_color_hex(0xffffff), 0); // 设置字体颜色为白色
    /* 设置返回事件 */
    lv_obj_add_event_cb(return_btn, return_btn_event_cb, LV_EVENT_CLICKED, NULL);
    
}
